<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .big{
            width: 500px;
            height: 500px;
            margin: 0 auto;
        }
        .box{
            width: 100px;
            height: 100px;
            background: #000;
            margin-top: 15px;
        }
        .bian{
            background: rgb(149, 62, 62);
        }
        .none{
            display: none;
        }
    </style>
</head>
<body>
    <div class="big">
    <button>变高</button>
    <button>变宽</button>
    <button>变色</button>
    <button>隐藏</button>
    <button>重置</button>

    <div class="box"></div>
    </div>
</body>
</html>
<script>
    var btn = document.querySelectorAll('button')
    var box = document.querySelector('.box')
    for (let i = 0; i < btn.length; i++) {
        btn[i].onclick = function (){
            if (btn[i] == btn[0]) {
                return box.style.width = "200px"
            }
            if (btn[i] == btn[1]) {
                return box.style.height = "300px"
            }
            if (btn[i] == btn[2]) {
                return box.classList.add('bian');
            }
            if (btn[i] == btn[3]) {
                return box.classList.add('none');
            }
            if (btn[i] == btn[4]) {
                return box.style.width = "100px" , 
                box.style.height = "100px" , 
                box.style.backgroundColor = "#000",
                box.style.display = 'block'
            }
        }
    }
</script>